Enabling `mod_rewrite` apache, permissions issues
Posted
by
rudolph9
on Server Fault
See other posts from Server Fault
or by rudolph9
Published on 2012-09-05T00:31:06Z
Indexed on
2014/06/08
21:28 UTC
Read the original article
Hit count: 177
In attempting to enable mod_rewrite
on the Apache2 web server installed with Mac OSX 10.7.4. Following these instruction, ultimately using the configuration to host CakePHP applications, I run into permissions issues accessing the site via a web browser when I set
the directory block associated with cakephp site
/etc/apache2/users/username.conf
from:
<Directory "/Users/username/Sites/">
Options Indexes FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
Allow from all
</Directory>
/etc/apache2/users/username.conf
to:
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride none
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/username/Sites/cakephp_app/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
The .htaccess
files are the CakePHP 2.2.2 default as follows:
/Users/username/Sites/cakephp_app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
/Users/username/Sites/cakephp_app/app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/Users/username/Sites/cakephp_app/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
When performing the request via a web browser at to http://0.0.0.0/~username/cakephp_app/index.php
the content of the response is
Not Found
The requested URL /Users/username/Sites/cakephp_app/app/webroot/ was not found on this server.
Apache/2.2.21 (Unix) DAV/2 PHP/5.3.10 with Suhosin-Patch Server at 0.0.0.0 Port 80
Upon a request to http://0.0.0.0/~username/
and http://0.0.0.0/~username/cakephp_app/
, added to /var/log/apache2/error_log
accordingly are the following:
[Tue Sep 04 22:53:26 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/Users, referer: http://0.0.0.0/~username/
[Tue Sep 04 22:53:26 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
What is causing the issue? Is there server program, ideally available via a homebrew script, which would make hosting CakePHP applications for testing purposes more effective and efficient?
© Server Fault or respective owner